﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIT.ScrumTool.Client.ControlService;

namespace UIT.ScrumTool.Client.Controller
{
    public class TeamCtrl
    {
        #region Thuoc Tinh
        //lay kenh Team
        private static ControlService.TeamServiceClient teamServiceClient = new ControlService.TeamServiceClient();
        #endregion

        public static List<TeamDto> TeamGetByAll()
        {
            try
            {
                return teamServiceClient.TeamGetByAll().ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static TeamDto TeamGetById(int id)
        {
            try
            {
                return teamServiceClient.TeamGetById(id);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static List<TeamDto> TeamGetByProjectId(int projectId)
        {
            try
            {
                return teamServiceClient.TeamGetByProjectId(projectId).ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static int TeamInsert(TeamDto teamDto)
        {
            try
            {
                return teamServiceClient.TeamInsert(teamDto);
            }
            catch (Exception)
            {
                return -1;
            }
        }

        public static bool TeamUpdate(TeamDto teamDto)
        {
            try
            {
                return teamServiceClient.TeamUpdate(teamDto);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool TeamDelete(int id)
        {
            try
            {
                return teamServiceClient.TeamDelete(id);
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
